export * from "./carrier"
export * from "./tracking"

export class Address {
  public id: string
  private first_name: string
  public last_name: string
  public country_code: string
  public phone: string
  public zip: string
  private province_id: string
  public province
  private city_id: string
  public city
  private county_id: string
  public county
  public address: string

  public get firstName() {
    return this.first_name
  }

  public set firstName(firstName) {
    this.first_name = firstName
  }

  public get lastName() {
    return this.last_name
  }

  public set lastName(lastName) {
    this.last_name = lastName
  }

  public get countryCode() {
    return this.country_code
  }

  public set countryCode(countryCode) {
    this.country_code = countryCode
  }

  public get provinceId() {
    return this.province_id
  }

  public set provinceId(provinceId) {
    this.province_id = provinceId
  }

  public get cityId() {
    return this.city_id
  }

  public set cityId(cityId) {
    this.city_id = cityId
  }

  public get countyId() {
    return this.county_id
  }

  public set countyId(countyId) {
    this.county_id = countyId
  }
}

export enum RateMode {
  Package = "package",
  Weight = "weight"
}

export class Zone {
  public id: string
  public name: string
  public locations: string[]
  public first: number
  private first_cost: number
  public additional: number
  private additional_cost: number

  public get firstCost() {
    return this.first_cost
  }

  public set firstCost(firstCost) {
    this.first_cost = firstCost
  }

  public get additionalCost() {
    return this.additional_cost
  }

  public set additionalCost(additionalCost) {
    this.additional_cost = additionalCost
  }
}

export class Rate {
  public id: string
  public name: string
  public mode: RateMode
  public zones: Zone[]
}


export class RateService {

  // public static getRates(countryId: string): Promise<Region[]> {
  //   return httpClient.get(`/v1/district/countries/${countryId}/regions`)
  //     .then(({ data }) => _.map(data, region => _.assign(new Region(), region, {
  //       provinces: _.map(region.provinces, province => _.assign(new Province(), province)),
  //     })))
  // }
}
